﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:CustomBusyIndicator.Controls">
    <Style TargetType="controls:BusyIndicator">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:BusyIndicator">
                    <Grid x:Name="Root" Background="#77000000">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup>
                                <VisualState x:Name="On">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="RotateTransform" Storyboard.TargetProperty="Angle" From="0" To="360" Duration="0:0:3.6" RepeatBehavior="Forever">
                                            <DoubleAnimation.EasingFunction>
                                                <BackEase EasingMode="EaseOut"/>
                                            </DoubleAnimation.EasingFunction>
                                        </DoubleAnimation>
                                        <DoubleAnimation Storyboard.TargetName="SnowFlakeTransform" Storyboard.TargetProperty="Angle" From="0" To="-360" Duration="0:0:0.9" RepeatBehavior="Forever"/>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Root">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Off">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Root">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border Width="108" Height="108" RenderTransformOrigin="0.5, 0.5" VerticalAlignment="Center" HorizontalAlignment="Center">
                            <Border.RenderTransform>
                                <RotateTransform x:Name="RotateTransform" Angle="0" />
                            </Border.RenderTransform>
                            <Path Width="26" Height="30" RenderTransformOrigin="0.5, 0.5" VerticalAlignment="Top" HorizontalAlignment="Center" Stretch="Fill" Fill="#FFF" Data="F1 M 24.2364,14.4654L 26.7472,11.9546L 28.9864,14.1937L 24.2364,18.9437L 24.2364,23.3826L 28.1494,21.1234L 29.8881,14.6348L 32.9468,15.4543L 32.0278,18.8842L 36.1129,16.5257L 37.6029,10.9648L 45.2498,13.0138L 43.2008,20.6607L 37.7936,19.2119L 33.5422,21.6664L 36.9721,22.5854L 36.1525,25.6442L 29.6639,23.9056L 25.8197,26.125L 29.6639,28.3444L 36.1525,26.6058L 36.9721,29.6646L 33.5422,30.5836L 37.7937,33.0381L 43.2009,31.5893L 45.2498,39.2362L 37.6029,41.2852L 36.1129,35.7243L 32.0278,33.3658L 32.9468,36.7957L 29.8881,37.6152L 28.1494,31.1266L 24.2364,28.8674L 24.2364,33.3063L 28.9864,38.0563L 26.7472,40.2954L 24.2364,37.7846L 24.2364,42.6937L 28.1947,46.652L 22.5968,52.25L 16.9989,46.652L 21.0697,42.5812L 21.0697,37.8641L 18.5589,40.375L 16.3197,38.1358L 21.0697,33.3858L 21.0697,28.8674L 17.2256,31.0869L 15.4869,37.5755L 12.4282,36.7559L 13.3472,33.326L 9.09577,35.7806L 7.64692,41.1878L 8.58307e-006,39.1388L 2.04899,31.4919L 7.60987,32.9819L 11.695,30.6234L 8.26511,29.7043L 9.0847,26.6456L 15.5733,28.3842L 19.4864,26.125L 15.5733,23.8658L 9.0847,25.6044L 8.26511,22.5457L 11.695,21.6266L 7.60988,19.2681L 2.04898,20.7581L 0,13.1112L 7.64691,11.0623L 9.09577,16.4694L 13.3472,18.924L 12.4282,15.4941L 15.4869,14.6746L 17.2256,21.1631L 21.0697,23.3826L 21.0697,18.8642L 16.3197,14.1142L 18.5589,11.875L 21.0697,14.3858L 21.0697,9.66876L 16.9988,5.5979L 22.5968,0L 28.1947,5.59796L 24.2364,9.55627L 24.2364,14.4654 Z M 20.4138,5.54169L 22.653,7.78082L 24.8922,5.54169L 22.653,3.30249L 20.4138,5.54169 Z M 20.4139,46.7083L 22.653,48.9475L 24.8922,46.7083L 22.653,44.4692L 20.4139,46.7083 Z M 3.70777,17.7725L 6.76654,16.9529L 5.94695,13.8942L 2.88818,14.7137L 3.70777,17.7725 Z M 39.3591,38.3558L 42.4179,37.5363L 41.5983,34.4775L 38.5396,35.2971L 39.3591,38.3558 Z M 39.3591,13.8942L 38.5395,16.9529L 41.5983,17.7725L 42.4179,14.7137L 39.3591,13.8942 Z M 3.70776,34.4775L 2.88817,37.5363L 5.94693,38.3558L 6.76652,35.2971L 3.70776,34.4775 Z ">
                                <Path.RenderTransform>
                                    <RotateTransform x:Name="SnowFlakeTransform"/>
                                </Path.RenderTransform>
                            </Path>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>